home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / lib / stdio / finitdesc.c < prev    next >
C/C++ Source or Header  |  1997-09-09  |  693b  |  37 lines

  1.  
  2. /*
  3.  *  Initialize a zerod file pointer
  4.  *
  5.  *  if interactive set line buffering
  6.  *
  7.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  8.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  9.  *    DICE-LICENSE.TXT.
  10.  */
  11.  
  12. #include <fcntl.h>
  13. #include <stdio.h>
  14.  
  15. void
  16. _finitdesc(fi, fd, flags)
  17. FILE *fi;
  18. int fd;
  19. short flags;
  20. {
  21.     if (fi == stdin || fi == stdout || fi == stderr)
  22.     flags |= __SIF_NOFREE;
  23.  
  24.     fi->sd_UC = -1;
  25.     fi->sd_Fd = fd;
  26.     fi->sd_Flags = flags | __SIF_OPEN;
  27.     fi->sd_BufSiz = _bufsiz;
  28.     fi->sd_WLeft = -1;
  29.     fi->sd_RLeft = -1;
  30.  
  31.     if (isatty(fi->sd_Fd) > 0)
  32.     fi->sd_Flags |= __SIF_IOLBF;
  33.     else
  34.     fi->sd_Flags |= __SIF_FILE;
  35. }
  36.  
  37.